package pe.gob.sunat.proyecto.controller;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import pe.gob.sunat.proyecto.service.UsuarioService;

/**
 * Application Lifecycle Listener implementation class StartupListener
 * 
 */
public class StartupListener implements ServletContextListener {
	private static final Logger logger = Logger
			.getLogger(StartupListener.class);

	/**
	 * Default constructor.
	 */
	public StartupListener() {

	}

	/**
	 * @see ServletContextListener#contextInitialized(ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent sce) {
		logger.debug("Inicializando...");
		// ApplicationContext context = WebApplicationContextUtils
		// .getWebApplicationContext(sce.getServletContext());
		// UsuarioService usuarioService = context.getBean("usuarioService",
		// UsuarioService.class);
		// sce.getServletContext().setAttribute("usuarioAdministrador",
		// usuarioService.getUsuarioPorUsername("admin"));
	}

	/**
	 * @see ServletContextListener#contextDestroyed(ServletContextEvent)
	 */
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
	}

}
